package com.shaoyu.tools.testcase.event.sync;

import com.shaoyu.tools.event.core.EventBusExecutor;
import com.shaoyu.tools.testcase.event.async.AsyncEventTestService;
import com.shaoyu.tools.testcase.event.async.AsyncTestEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

/**
 * @author shaoyu
 * @date 2022/11/22 10:56
 */
@Service
public class SyncEventTestService {

    Logger logger = LoggerFactory.getLogger(SyncEventTestService.class);

    /**
     * http://localhost:8888/test/syncEventTestService/testSendEvent/%7B%22msg%22:%22hello%20world%22%7D
     */
    public String testSendEvent(AsyncTestEvent event){
        logger.info(this.getClass().getSimpleName()+"#"+"testSendEvent()");

        logger.info("发送事件 AsyncTestEvent");

        EventBusExecutor.sendEvent(event);

        logger.info("事件已发送 AsyncTestEvent");
        return event.getMsg();
    }




}
